<?php
/**
 * Created by PhpStorm.
 * User: MIS
 * Date: 2018/10/29
 * Time: 10:10
 */
namespace Admin\Controller;
use Think\Controller;
class BlankController extends Controller
{
    public function index(){
        $blank= M();
        $id=I("id");
        $username=I("username");
        session("tid",$id);
        $s="select COUNT(id)  FROM ks_tk  where tid='$id'";
        $count=$blank->query($s);
//        var_dump($count["0"]["COUNT(id)"]);
//        exit();
        $sql="select id,content,success FROM ks_tk where tid='$id'";
        $new_test=$blank->query($sql);
        $this->assign("data",$new_test);
        $this->assign("username",$username);
        $this->assign('news_count',$count["0"]["COUNT(id)"]);
        $this->display();
    }

    public function edit($id){

        redirect(U('/Admin/EditBlank/index',array('id'=>$id)));
    }
    public function add(){

        redirect(U('/Admin/EditBlank/index'));
    }
    public function  delete($id){
        $article=M('tk');
        $a= $article->where('`id`='.$id)->delete();
        if($a){
            $this->success('该提删除成功',U('/Admin/Blank/index',array('id'=>$_SESSION["id"])));
        }else{
            $this->error('该提删除失败');
        }
    }

}